﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Domain.Interface;
using Ds.DataBase;
using Ds.DataBase.Model;

namespace Domain.RealiZation
{
    public class Class1 : IClass1
    {
        public void Add()
        {
            using (UserInfoClassContext db = new UserInfoClassContext())
            {
                var zhiwei = db.ZhiWeiContext.Add(new ZhiWei() { zwmc = "zhiwei" });
                var userinfo = db.UserInfoContext.Add(new UserInfo() { username = "aaa", password = "bbb", userinfoId = Guid.NewGuid() });
                var zw = db.KeShiZhiWuContext.FirstOrDefault();
                db.JiaoZhiGongInfoContext.Add(new JiaoZhiGongInfo()
                { Users = userinfo, ShouJiHao = "13313313313", XingMing = "姓名", kszw = zw });
                db.SaveChanges();
            }
        }

        public bool Chk()
        {
            using (UserInfoClassContext db = new UserInfoClassContext())
            {
                var name = "aaa";
                return db.UserInfoContext.Any(s => s.username == name);
            }
        }
    }
}
